package cn.kgc.tangcco.util;

/**
 * @author 李昊哲
 * @Description 数学工具类
 * @date 2020/8/17 上午9:25
 */
public class MathUtil {
    /**
     * 获取两个int的整数的最大值
     *
     * @param a int类型整数
     * @param b int类型整数
     * @return 两个int的整数的最大值
     */
    public static int max(int a, int b) {
        return (a > b) ? a : b;
    }

    /**
     *
     * @param fisrtNumber
     * @param lastNumber
     * @return
     */
    public static int sum(int fisrtNumber, int lastNumber) {
        int sum = 0;
        if (fisrtNumber > lastNumber) {
            int temp = fisrtNumber;
            fisrtNumber = lastNumber;
            lastNumber = temp;
        }
        for (int i = fisrtNumber; i < lastNumber; i++) {
            sum += i;
        }
        return sum;
    }

}
